#include <stdio.h>
#include <string.h>
#include <math.h>

main()
{
//	 freopen("input", "r", stdin);
//	 freopen("output", "w",stdout);
	char s[100];
	int hour=0,minute=0,second=0;
	int hh,mm,ss;
	double speed=0, speed2=0;
	int time;
	double dis;

//	gets(s);
//	sscanf(s,"%d:%d:%d %lf", &hour, &minute, &second, &speed);
	speed=0;
	dis=0;
	while (gets(s))
	{
		
		if (strstr(s," ")!=0 && strlen(s)>9) 
		{
			sscanf(s,"%d:%d:%d %lf", &hh, &mm, &ss, &speed2);
			time= ((hh-hour)*60+mm-minute)*60+ss-second;
			hour=hh;minute=mm;second=ss;
			dis+=speed*time;
			//dis=0;
			speed=speed2;
		}
		else if (strlen(s)!=0)
		{
			sscanf(s,"%d:%d:%d", &hh, &mm, &ss);
			time= ((hh-hour)*60+mm-minute)*60+ss-second;
			hour=hh;minute=mm;second=ss;
			dis+=speed*time;
			printf("%s %.2lf km\n", s,dis/3600);


		}
	}
	

	return 0;
}